<!doctype html>
<html lang="en">

<head>
	<meta charset="utf-8"/>
	<title>Dashboard I Admin Panel</title>
	
	<link rel="stylesheet" href="css/layout.css" type="text/css" media="screen" />
	<!--[if lt IE 9]>
	<link rel="stylesheet" href="css/ie.css" type="text/css" media="screen" />
	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
	<script src="js/jquery-1.5.2.min.js" type="text/javascript"></script>
	<script src="js/hideshow.js" type="text/javascript"></script>
	<script src="js/jquery.tablesorter.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/jquery.equalHeight.js"></script>
	
	<script type="text/javascript">
	$(document).ready(function() { 
      	  $(".tablesorter").tablesorter();
   	 });

	$(document).ready(function() {

	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

});
    </script>
    
	<script type="text/javascript">
    $(function(){
        $('.column').equalHeight();
    });
   </script>

	<script>
		$(document).ready(function(){
		$('#new_user_section').hide();
			 $('#newuser').click(function(){
				$('#main').hide();
				$('#new_user_section').show();
			});
			
			$('#newarticle').click(function(){
				$('#main').show();
				$('#new_user_section').hide();
			});
			
		});
	</script>

	<script>
		function deleteRow(id){

			var conf_val = confirm("Do u really want to delete this Location ?");
			if(conf_val == true){
				window.location="commonController/DeleteLocationController.php?id="+id;
			}
			
		}
	</script>
	<script>
		function editRow(id){
			var locationId = document.getElementById("location"+id);
			var locationName = locationId.textContent;
			document.getElementById("location").value = locationName;
			document.getElementById("locationId").value = locationId.parentNode.id;			
		}
	</script>

</head>


<body>

	<section id="main" class="column">
		
		<h4 class="alert_info">Welcome to the Admin panel of Location</h4>
		
		<article class="module width_3_quarter">
		<header><h3 class="tabs_involved">Location Manager</h3>
		<ul class="tabs">
   			<li><a href="#tab1">Posts</a></li>
    		<li><a href="#tab2">Comments</a></li>
		</ul>
		</header>

		<div class="tab_container">
			<div id="tab1" class="tab_content" style="height:280px;overflow:auto;">
				<table class="tablesorter" id="locationData" cellspacing="0"> 
			<thead> 
				<tr> 
    				<th>Location Name</th> 					
					<th>Created On</th> 
					<th>Actions</th> 
				</tr> 
			</thead> 
			<tbody> 

			<?php 
				 //Connects to your Database 
				 $db_host = 'localhost';
				 $db_user = 'function';
				 $db_pwd = 'w9ak4X1l0Y';

				 $database = 'function_a5110060';

				 $con = mysql_connect($db_host, $db_user, $db_pwd); 
				 mysql_select_db($database,$con) or die(mysql_error()); 
				 $data = mysql_query("SELECT master_location_id,master_location_name,created_date FROM Location_Master") 
				 or die(mysql_error()); 
				 while($info = mysql_fetch_array( $data )) 
				 { 
					 Print "<tr id=".$info['master_location_id'].">";
					 Print	"<td id=location".$info['master_location_id'].">".$info['master_location_name']."</td>";   
					 Print	"<td>".$info['created_date']."</td>";
					 Print	"<td><a href='#' onclick='editRow(this.id)'  id=".$info['master_location_id']."><input type='image' src='images/icn_edit.png' title='Edit'></a><a href='#' onclick='deleteRow(this.id)'  id=".$info['master_location_id']."><input type='image' src='images/icn_trash.png' title='Trash'></a></td>";
					 Print "</tr>"; 
				 } 
			?> 
			</tbody> 
			</table>
			</div><!-- end of #tab2 -->
			
		</div><!-- end of .tab_container -->
		
		</article><!-- end of content manager article -->
		
		<article class="module width_quarter">
			<header><h3>Registered Contacts</h3></header>
			<div class="message_list">
				<div class="module_content">
					<div class="message"><p><input type="checkbox">Kameshwara Pavan Kumar Mantha</p>
					<p><strong>9949493991</strong></p></div>
					<div class="message"><p><input type="checkbox">Krishna Pandu Ranga Malladi</p>
					<p><strong>9491884908</strong></p></div>
					<div class="message"><p><input type="checkbox">Raju</p>
					<p><strong>1234567890</strong></p></div>
					<div class="message"><p><input type="checkbox">Vishal</p>
					<p><strong>1234567890</strong></p></div>
					<div class="message"><p><input type="checkbox">Keshav</p>
					<p><strong>1234567890</strong></p></div>
				</div>
			</div>
			<footer>
				<form class="post_message">
					<input type="text" value="Message" onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;">
					<input type="submit" class="btn_post_message" value=""/>
				</form>
			</footer>
		</article><!-- end of messages article -->
		
		<div class="clear"></div>
		
		<form method="POST" action="commonController/AddLocationController.php">
		<article class="module width_full">
			<header><h3>Add or Update Location</h3></header>
				<div class="module_content">
						<fieldset>
							<label>Location Name</label>
							<input type="text" name="location" id="location">
							<input type="text" name="locationId" id="locationId" style="display: none;"/>
						</fieldset><div class="clear"></div>
				</div>
			<footer>
				<div class="submit_link">
					<input type="submit" value="Add or Update Location" class="alt_btn">
					<input type="reset" value="Reset" >
				</div>				
			</footer>
		</article><!-- end of post new article -->
		</form>
		
		
		<div class="spacer"></div>
	</section>
	


</body>

</html>